<?php
session_cache_expire(999999999);
if(!isset($_SESSION)) 
{ 
session_start(); 
} 
if(!isset($_SESSION['user'])){
	echo "timeout";
}else{
header('Content-Type: charset=utf-8');
include '../operations/connection.php';

	 	$idtestproject = $_REQUEST['idtestproject'];
		$id_employee = $_REQUEST['id_employee'];
		$id = $_REQUEST['idproject'];
		$tempcodetestpro = $_REQUEST['tempcodetestpro'];
		$recyclebin = $_REQUEST['recyclebin'];
		$newlang = $_REQUEST['newlang'];
		$page = isset ( $_REQUEST["page"] ) ? intval ( $_REQUEST["page"] ) : 1;
		if ($_REQUEST['newlang'] == "EN") {
			include "../value/value_en.php";
		} else if($_REQUEST['newlang'] == "VN") {
			include "../value/value_vn.php";
		}
		else {
			include "../value/value_kr.php";
		}
		
		$queryListErrorByIDPr = mysql_query("SELECT tp.IDTest, tp.IDProject, tp.IDEmployee, tp.Title, tp.TextTest, tp.Time, tp.UpdateTime, tp.`Status`, tp.`Correct`,e.FullName,
				tp.`Delete`,tp.IDTestTemp,tp.IdPriorityColor, pc.backgroundColor,pc.backgroundConfirm 
			   	FROM pr_testproject tp, employee e,priority_color pc  
			    WHERE tp.IDTest = '$idtestproject' AND tp.IDProject = '$id' AND e.IDEmployee = tp.IDEmployee  AND pc.id = tp.IdPriorityColor 
			    ORDER BY IDTest DESC;");
		$sql= "SELECT tp.IDTest, tp.IDProject, tp.IDEmployee, tp.Title, tp.TextTest, tp.Time, tp.UpdateTime, tp.`Status`, tp.`Correct`,e.FullName,
				tp.`Delete`,tp.IDTestTemp,tp.IdPriorityColor, pc.backgroundColor,pc.backgroundConfirm 
			   	FROM pr_testproject tp, employee e,priority_color pc  
			    WHERE tp.IDTest = '$idtestproject' AND tp.IDProject = '$id' AND e.IDEmployee = tp.IDEmployee  AND pc.id = tp.IdPriorityColor 
			    ORDER BY IDTest DESC;";
		$listattach = mysql_query('select id, testprojectid, filepath, filereal, filename, filetype, filesize, createdate
		 from pre_attach where testprojectid='.$idtestproject);
		
		$sql1=mysql_query("select sum(c.`status`) as charge from pr_charge c where c.id_testproject=$idtestproject and c.id_employee=$id_employee");
		$r=mysql_fetch_array($sql1);
		if($r['charge']=="")
			$charge=0;
		else $charge=$r['charge'];
		
?>
<?php while ($row=mysql_fetch_array($queryListErrorByIDPr)){
				$sql2=mysql_query("select p.* from pr_project p where p.IDProject=$id");
				$r2=mysql_fetch_array($sql2);
				$code=$r2['IDView'].'-'.$row['IDTestTemp'];
				$idemplTestpro = $row['IDEmployee'];
				$prdelete = $row['Delete'];
				$titletestpro = $row['Title'];
				$contenttestpro = $row['TextTest'];
				$fullnames = $row['FullName'];
				$time = $row['Time'];
				
				$bgcolor = $row['backgroundColor'];
				$idprioty = $row['IdPriorityColor'];
				
				$correct=$row['Correct'];
				
				$status = $row['Status'];
				$temp_status ="";
				if ($status==2){
					$bgcolor = $row['backgroundConfirm'];
					if($correct==0)
						$bgcolor = "B0A5CA";
				}
				if($prdelete==1)
					$bgcolor='8A898F';
				$updatetime=$row['UpdateTime'];
				//echo $updatetime;
				//$stringcolortest = eregi_replace(chr(13),"<br>",substr($row['Title'],0,-14));
				$stringcolortest = substr($row['Title'],0,-14);
				$idtesppr_temp = $row['IDTestTemp'];
				?>
					<td class="rf-dt-c" style="width: 7%; vertical-align: middle; text-align: center;min-width: 7%">
					<?php echo $tempcodetestpro;?>
					
					</td>
					<td class="rf-dt-c"
						style="width:5%;vertical-align: middle; text-align: center;min-width: 5%">
						<?php if ($prdelete==1){?><span title="<?=$l_deleted?>" class="clickedit" style="width:60px;">
							<img src="images/del.png"  style="width: 32px;" alt="<?php echo $l_deleted?>" /></span>
						<?php }else if ($status==0){?><span title="<?=$l_no_fix?>" class="clickedit" style="width:60px;">
							<img src="images/unconfirm.png"  style="width: 32px;" alt="<?php echo $l_no_fix?>" /></span>
						<?php }else if ($status==1){?>
							<span title="<?=$l_fix_complete?>" class="clickedit" style="width:60px;">
							<img src="images/fixed.png"  style="width: 32px;" alt="<?php echo $l_fix_complete?>" /></span>
						<?php }else if ($status==2){?>
							<span title="<?=$l_confirm_excel?>" class="clickedit" style="width:60px;">
							<img src="images/confirm.png"  style="width: 32px;" alt="<?php echo $l_confirm_excel?>" /></span>
						<?php }else if ($status==-1){
								if($correct==1){
								?>
								<span title="<?=$l_newerror?>" class="clickedit" style="width:60px;">
								<img src="images/newerror.png"  style="width: 32px;" alt="<?php echo $l_newerror?>" /></span>
							<?php }else{?>
								<span title="<?php echo $l_incorrect;?>" class="clickedit" style="width:60px;">
								<img src="images/notfix.png"  style="width: 32px;" alt="<?php echo $l_incorrect;?>" />
								</span>
						<?php }}?>
					</td>
					<td class="rf-dt-c" colspan="6" style="padding: 0; vertical-align: middle;">
						<div  style="background:white; border:1px solid #c4c0c9; padding:10px;margin:9px;" id="parentcommand">
							<form action="content-project/add-comment.php" onsubmit="return AIM.submit(this, {'onStart': add_comment(this), 'onComplete': add_comment_completed})" id="formcomments">
								<div class="acomment" id="themcommand" style="background:white; border:1px solid #c4c0c9; padding:10px;display: none">
			                        <br class="clear" />
			                    	<span style="display: block; text-align: left"><?php echo $l_comment?> : </span>
			                    	<textarea style="width:100%; border:1px solid #c4c0c9" cols="5" rows="3" id="titlecomment" name="comment"></textarea>
			                        <div style='padding-top:2px;margin-left:20px'>
							 		  <?php include '../admin/attachcomment/attach.php';?>
							 	    </div>
			                        <div style="text-align:right">
			                        	<input type="hidden" name="id">
			                        	<input type="hidden" name="idtestpro" value="<?=$idtestproject?>">
			                        	<input type="hidden" name="idemp" value="<?=$id_employee?>">
			                        	<input type="hidden" name="stylecolor" id="stylecolor" value="424242">
			                        	<input type="hidden" name="newlang" value="<?=$_SESSION['lang']?>">
			                        	<input class="buttonProject" type="button" style="margin: 5px 0;" value="<?php echo $l_sendmail?>" onclick="showsendmailProject()"/>
			                            <input class="buttonProject" type="button" style="margin: 5px 0;" value="<?php echo $l_ok?>" onclick="ClickOK();" ondblclick="" />
			                            <input class="buttonProject aclose" type="button" style="margin: 5px 0;" value="<?php echo $l_cancel?>" id="cancelthemcommand" onclick="closethemcommand(this)"/>
			                        </div>
		                   		</div> 
							</form>
							
							<form action="content-project/add-translate.php" onsubmit="return AIM.submit(this, {'onStart': add_translate(this), 'onComplete': add_translate_completed})" id="formtranslates">
								<div class="acomment" id="themtranslate" style="background:white; border:1px solid #c4c0c9; padding:10px;display: none">
			                        <br class="clear" />
			                    	<span style="display: block; text-align: left"><?=$l_translate?> : </span>
			                    	<textarea style="width:100%; border:1px solid #c4c0c9" cols="5" rows="3" id="titletranslate" name="comment"></textarea>
			                     
			                        <div style="text-align:right">
			                        	<input type="hidden" name="id">
			                        	<input type="hidden" name="idtestpro" value="<?=$idtestproject?>">
			                        	<input type="hidden" name="idemp" value="<?=$id_employee?>">
			                        	<input type="hidden" name="stylecolor" id="stylecolor" value="424242">
			                        	<input type="hidden" name="newlang" value="<?=$_SESSION['lang']?>">
			                            <input class="buttonProject" type="button" style="margin: 5px 0;" value="<?php echo $l_ok?>" onclick="ClickOK1();" ondblclick="" />
			                            <input class="buttonProject aclose" type="button" style="margin: 5px 0;" value="<?php echo $l_cancel?>" id="cancelthemtranslate" onclick="closethemtranslate(this)"/>
			                        </div>
		                   		</div> 
							</form>
							
							<form action="content-project/add-cause.php" onsubmit="return AIM.submit(this, {'onStart': add_cause(this), 'onComplete': add_cause_completed})" id="formcauses">
								<div class="acomment" id="themcause" style="background:white; border:1px solid #c4c0c9; padding:10px;display: none">
			                        <br class="clear" />
			                    	<span style="display: block; text-align: left"><?=$l_cause?> : </span>
			                    	<textarea style="width:100%; border:1px solid #c4c0c9" cols="5" rows="3" id="titlecause" name="comment"></textarea>
			                     
			                        <div style="text-align:right">
			                        	<input type="hidden" name="id">
			                        	<input type="hidden" name="idtestpro" value="<?=$idtestproject?>">
			                        	<input type="hidden" name="idemp" value="<?=$id_employee?>">
			                        	<input type="hidden" name="stylecolor" id="stylecolor" value="424242">
			                        	<input type="hidden" name="newlang" value="<?=$_SESSION['lang']?>">
			                            <input class="buttonProject" type="button" style="margin: 5px 0;" value="<?php echo $l_ok?>" onclick="ClickOK2();" ondblclick="" />
			                            <input class="buttonProject aclose" type="button" style="margin: 5px 0;" value="<?php echo $l_cancel?>" id="cancelthemcause" onclick="closethemcause(this)"/>
			                        </div>
		                   		</div> 
							</form>
							<form action="content-project/add-deadline.php" onsubmit="return AIM.submit(this, {'onStart': add_deadline(this), 'onComplete': add_deadline_completed})" id="formdeadlines">
								<div class="acomment" id="themdeadline" style="background:white; border:1px solid #c4c0c9; padding:10px;display: none">
			                        <br class="clear" />
			                    	<span style="display: block; text-align: left"><?=$l_deadline?> : </span>
			                    	<input style="width:100%; border:1px solid #c4c0c9;height: 24px;width: 140px;" id="titledeadline" name="comment" />(yyyy-mm-dd)
			                     
			                        <div>
			                        	<input type="hidden" name="id">
			                        	<input type="hidden" name="idtestpro" value="<?=$idtestproject?>">
			                        	<input type="hidden" name="idemp" value="<?=$id_employee?>">
			                        	<input type="hidden" name="code" value="<?=$code?>">
			                        	<input type="hidden" name="stylecolor" id="stylecolor" value="424242">
			                        	<input type="hidden" name="newlang" value="<?=$_SESSION['lang']?>">
			                            <input class="buttonProject" type="button" style="margin: 5px 0;" value="<?php echo $l_ok?>" onclick="ClickOK3();" ondblclick="" />
			                            <input class="buttonProject aclose" type="button" style="margin: 5px 0;" value="<?php echo $l_cancel?>" id="cancelthemdeadline" onclick="closethemdeadline(this)"/>
			                        </div>
		                   		</div> 
							</form>
							<div class="odd1" style=" padding-left:10px; border:1px solid #ddd; font-size: 13px;" id="ajaxLstComment">
								<div  style="background-color: <?php echo "#".$bgcolor;?>; padding:10px;margin-left:-10px;  font-weight:bold;">
									<?php if(strlen($stringcolortest)==0){ echo  $titletestpro ;}else{echo  $stringcolortest;}?>
									<?php $querytranslate = mysql_query("select c.IDComment,c.IDTestProject,c.IDEmployee,c.Comment,c.DateComment,
													 e.IDEmployee,e.FullName,c.IDTestProject from pr_translate c, employee e 
														 where c.IDEmployee = e.IDEmployee and c.IDTestProject = '$idtestproject' ORDER BY  c.DateComment ASC;");
									if (mysql_num_rows($querytranslate)>0){
									?>
														 <br>
														 <?php }?>
														 <div style="padding:5px;" id="ajaxtranslate"> 
				                        <?php  
						                        
						                        while ($rowcoment = mysql_fetch_array($querytranslate)){
						                        		$idcomment = $rowcoment['IDComment'];
						                        		$idemployeecomment = $rowcoment['IDEmployee'];
														$stringcolor1 = substr($rowcoment['Comment'],0,-14);
														?>
												<div style="border-bottom: 1px solid #C4C0C9;border-right: 1px solid #C4C0C9;">
							                        	<span style="font-size: 13px; color: #424242;"> <?php if (strlen($stringcolor1)==0){echo " $l_translate : ".$rowcoment['Comment'];}else{echo "$l_translate : ".$stringcolor1;}?></span> 
							                        	<i style="color:#424242; display:block; text-align:right;padding-right:60px; font-size: 13px;"><?php echo $rowcoment['FullName']." (".$rowcoment['DateComment'].")"?></i>
							                        	<?php if($idemployeecomment==$id_employee || $_SESSION['posmanager']==1){?>
							 							<span  style="color:#236DA4;cursor: pointer;float: right;margin-top: -25px;" onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ delete_translate('<?=$idcomment?>','<?=$idtestproject?>','<?=$id_employee?>');return true}else{return false}">[ <?=$l_delete?> ]</span>
							 							<?php }?>
						                         </div>
						                         
						                         
						                        
					                  	 <?php }?>
					              		 </div>
					              		 
					              		 <?php $querycause = mysql_query("select c.IDComment,c.IDTestProject,c.IDEmployee,c.Comment,c.DateComment,
													 e.IDEmployee,e.FullName,c.IDTestProject from pr_cause c, employee e 
														 where c.IDEmployee = e.IDEmployee and c.IDTestProject = '$idtestproject' ORDER BY  c.DateComment ASC;");
					              		 		if (mysql_num_rows($querycause)>0){
					              		 ?>
														 <br>
														 <?php }?>
														 <div style="padding:5px;" id="ajaxcause"> 
				                        <?php  
						                        
						                        while ($rowcoment = mysql_fetch_array($querycause)){
						                        		$idcomment = $rowcoment['IDComment'];
						                        		$idemployeecomment = $rowcoment['IDEmployee'];
														$stringcolor1 = substr($rowcoment['Comment'],0,-14);
														?>
												<div style="border-bottom: 1px solid #C4C0C9;border-right: 1px solid #C4C0C9;">
							                        	<span style="font-size: 13px; color: #424242;"> <?php if (strlen($stringcolor1)==0){echo " $l_cause : ".$rowcoment['Comment'];}else{echo "$l_cause : ".$stringcolor1;}?></span> 
							                        	<i style="color:#424242; display:block; text-align:right;padding-right:60px; font-size: 13px;"><?php echo $rowcoment['FullName']." (".$rowcoment['DateComment'].")"?></i>
							                        	<?php if($idemployeecomment==$id_employee || $_SESSION['posmanager']==1){?>
							 							<span  style="color:#236DA4;cursor: pointer;float: right;margin-top: -25px;" onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ delete_cause('<?=$idcomment?>','<?=$idtestproject?>','<?=$id_employee?>');return true}else{return false}">[ <?=$l_delete?> ]</span>
							 							<?php }?>
						                         </div>
						                         
						                         
						                        
					                  	 <?php }?>
					              		 </div>
								</div>
								
								<div style="background-color :#FFFFFF;  padding:10px;min-height: 30px; "><?php echo $contenttestpro?>
								
								<?php if($updatetime!=""){?>
								<br>
								<p style=" margin-left: -10px;font-size:11px; color:#000; float:left; width:60%"><?php echo $l_last.$updatetime;?></p>
								<?php }?>
								</div>
								
								<div style="padding:0 8px">
									<?php 
									$temindex = 0;
									while ($rowattach = mysql_fetch_array($listattach)) {?>
										<div style="padding:1px">
											<img src="images/dinhkem.png"/>
											<a href="admin/attach/downloadattach.php?filepath=<?=$rowattach['filereal']?>&filename=<?=$rowattach['filename']?>&filetype=<?=$rowattach['filetype']?>">
												<?=$rowattach['filename']."(".$rowattach['filetype'].") ".$rowattach['filesize']?></a>
										</div>
									<?php $temindex+=1;}
									?>
								</div>
								<div style="border-bottom: 1px dotted gray; padding-bottom: 5px;margin-bottom: 5px;"></div>
							</div>
	                        <div style="background:#f7f7f7; width:100%"> 
	                            <div style=" padding:10px; font-size:11px; color:#000; float:left; width:60%"><?php echo $fullnames."(".$time.")"?></div>
	                            <div style="float:right;" class="comment" >
	                            
	                           <input class="buttonProject hcomment" type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_translate?>" id="showcommand2" onclick="showthemcommand2(this)"/>
	                           <input class="buttonProject hcomment" type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_cause?>" id="showcommand3" onclick="showthemcommand3(this)"/>
	                           <?php if($_SESSION['posmanager']==1 || $charge==1){?>
	                           <input class="buttonProject hcomment" type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_deadline?>" id="showcommand4" onclick="showthemcommand4(this)"/>
	                           <?php }?>
	                           <?php 
														if($_SESSION['posmanager']==1 && $prdelete==0){?>
							                            <input class="buttonProject hcomment" type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_delete?>" id="deletetestProject" onclick="deletetestProject('<?=$id?>','<?=$idtestproject?>','<?=$id_employee?>','<?=$page?>')"/>
							                         <?php }else {}?>
								<?php if ($status==2){
										if (($idemplTestpro==$id_employee) || ($_SESSION['posmanager']==1)){?>
									
											<!--  <input class="buttonProject hrestore" type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_reopen?>" 
												 onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ processReopenTestPro('<?=$id?>','<?=$idtestproject?>','<?=$id_employee?>',<?=$page?>,this);  return true;}else{return false;}"/> |-->
								
										<!--<input class="buttonProject hclose" type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_close?>" onclick="onclickError('<?=$id?>','<?=$id_employee?>','<?=$page?>')"/>-->
									<?php }else{?>
											<!--<input class="buttonProject hclose" type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_close?>" onclick="onclickError('<?=$id?>','<?=$id_employee?>','<?=$page?>')"/>-->
									<?php 	}
									}else if ($status==1){
										if (($_SESSION['postest']==1) || ($_SESSION['posmanager']==1)){
											 if ((($idemplTestpro==$id_employee)|| ($_SESSION['posmanager']==1)) && ($prdelete==0)) {?>
												<!-- <a class="conf" onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ processConfirmTestPro('<?=$id?>','<?=$idtestproject?>','<?=$id_employee?>',<?=$page?>,this);  return true;}else{return false;}"><img src="images/icon_confirm.png" alt="" /><?=$l_confirm_excel?></a>
												<a class="not_fix" onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ processNotFixTestPro('<?=$id?>','<?=$idtestproject?>','<?=$id_employee?>',<?=$page?>,this);  return true;}else{return false;}"><img src="images/icon_not_fix.png" alt="" /><?=$l_no_fix?></a> | -->
												
												<input class="buttonProject " type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_edit?>" 
		                                			onclick="edittile_testproject('<?=$idtestproject?>','<?=$id?>','<?=$id_employee?>','<?=$idprioty?>','<?=$page?>')" />
											<?php }?>
									
										<!--<input class="buttonProject hcomment" type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_comment?>" id="showcommand1" onclick="showthemcommand(this)"/>
										<input class="buttonProject hclose" type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_close?>" onclick="onclickError('<?=$id?>','<?=$id_employee?>','<?=$page?>')"/>-->
									<?php }else{?>
												
										<?php if ((($idemplTestpro==$id_employee)|| ($_SESSION['posmanager']==1)) && ($prdelete==0)){?>
											<input class="buttonProject " type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_edit?>" 
		                                			onclick="edittile_testproject('<?=$idtestproject?>','<?=$id?>','<?=$id_employee?>','<?=$idprioty?>','<?=$page?>')" />
										<?php }?>
											<!-- <input class="buttonProject hcomment" type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_comment?>" id="showcommand1" onclick="showthemcommand(this)"/>
											<input class="buttonProject hclose" type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_close?>" onclick="onclickError('<?=$id?>','<?=$id_employee?>','<?=$page?>')"/> -->
									<?php 	}
									}else if (($status==0) || ($status==-1) ){
										if (($_SESSION['postest']==1) || ($_SESSION['posmanager']==1)){
											$flag = 0;
										
											 if (($idemplTestpro==$id_employee)|| ($_SESSION['posmanager']==1)){
											$flag=1;?>
												<!--  <a class="conf" onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ processConfirmTestPro('<?=$id?>','<?=$idtestproject?>','<?=$id_employee?>',<?=$page?>,this);  return true;}else{return false;}"><img src="images/icon_confirm.png" alt="" /><?=$l_confirm_excel?></a> |-->
											<?php }?>
									
										<?php if (($_SESSION['poscoder']==0)|| ($_SESSION['posmanager']==1)){
												?>
												<!--<a class="not_fix" onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ processFixedTestPro('<?=$id?>','<?=$idtestproject?>','<?=$id_employee?>',<?=$page?>,this);  return true;}else{return false;}"><img src="images/icon_fix.png" alt="" /><?=$l_fix_complete?></a> |-->
										<?php }
											if($flag==1 && ($prdelete==0)){?>
										<input class="buttonProject " type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_edit?>" 
		                                			onclick="edittile_testproject('<?=$idtestproject?>','<?=$id?>','<?=$id_employee?>','<?=$idprioty?>','<?=$page?>')" />
										<?php }?>
											<!--	<input class="buttonProject hcomment" type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_comment?>" id="showcommand1" onclick="showthemcommand(this)"/>
												<input class="buttonProject hclose" type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_close?>" onclick="onclickError('<?=$id?>','<?=$id_employee?>','<?=$page?>')"/>-->
										<?php }else{?>
											<?php if ((($idemplTestpro==$id_employee)|| ($_SESSION['posmanager']==1))&& ($prdelete==0)){?>
													<input class="buttonProject " type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_edit?>" 
			                                			onclick="edittile_testproject('<?=$idtestproject?>','<?=$id?>','<?=$id_employee?>','<?=$idprioty?>','<?=$page?>')" />
											<?php }?>
												<!--	<a class="not_fix" onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ processFixedTestPro('<?=$id?>','<?=$idtestproject?>','<?=$id_employee?>',<?=$page?>,this);  return true;}else{return false;}"><img src="images/icon_fix.png" alt="" /><?=$l_fix_complete?></a> |
													<input class="buttonProject hcomment" type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_comment?>" id="showcommand1" onclick="showthemcommand(this)"/>
													<input class="buttonProject hclose" type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_close?>" onclick="onclickError('<?=$id?>','<?=$id_employee?>','<?=$page?>')"/>-->
									<?php 	} 
									}?>
		                            
	                             </div>
	                            <div class="clear"></div> 
	                        </div>
							<?php $querycomment = mysql_query("select c.IDComment,c.IDTestProject,c.IDEmployee,c.Comment,c.DateComment,
								 e.IDEmployee,e.FullName,c.IDTestProject from pr_comment c, employee e 
									 where c.IDEmployee = e.IDEmployee and c.IDTestProject = '$idtestproject' ORDER BY  c.DateComment ASC;")?>
		                        <div style="background:white; padding:5px; border:1px solid #ddd; font-size: 13px;"> 
		                        	<div style="background:white; padding:5px; border:1px solid #ddd;" id="ajaxcomment"> 
				                        <?php 
				                        if(count($querycomment)>0){
				                        	?>
					                  		<table style="width: 100%;">
					                        <?php  
						                        $vitri=0;
						                        while ($rowcoment = mysql_fetch_array($querycomment)){
						                        	$vitri++;
						                        		$idcomment = $rowcoment['IDComment'];
						                        		$idemployeecomment = $rowcoment['IDEmployee'];
														$stringcolor = substr($rowcoment['Comment'],0,-14);
														$listattachcomment = mysql_query('select id, commentid, filepath, filereal, filename, filetype, filesize, createdate
															 from pre_commentattach where commentid='.$idcomment);?>
												<tr id="mo" style="background: <?php if($vitri%2==0) echo '#f2f9ff'; else echo '#ffffff';?>; font-size: 13px;">
													<td class="rf-dt-c" style="padding: 0; vertical-align: middle; width: auto;">
							                        	<span style="font-size: 13px;">
							                        		<?php if (strlen($stringcolor)==0){echo " + ".$rowcoment['Comment'];}else{echo " + ".$stringcolor;}?>
														</span>
															<?php 
																while ($rowattachC = mysql_fetch_array($listattachcomment)) {?>
															<div style="padding:1px"><img src="images/dinhkem.png"/>
																<a href="admin/attachcomment/downloadattach.php?filepath=<?=$rowattachC['filereal']?>&filename=<?=$rowattachC['filename']?>&filetype=<?=$rowattachC['filetype']?>">
																	<?=$rowattachC['filename']."(".$rowattachC['filetype'].") ".$rowattachC['filesize']?></a>
															</div>
															<?php }?>
						                            	<i style="color:#424242; display:block; text-align:right; padding-top:5px;padding-right:15px; font-size: 13px;"><?php echo $rowcoment['FullName']." (".$rowcoment['DateComment'].")"?></i>
						                           </td>
						                           <td class="rf-dt-c" style="width: 25px; vertical-align: middle; text-align: center;min-width: 80px">
							                          <?php 
														if($_SESSION['posmanager']==1){?>
							                            <span onmouseover="this.style.cursor='pointer'" onmouseout="this.style.cursor='default'" style="color:#236DA4" onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ delete_comment('<?=$idcomment?>','<?=$idtestproject?>','<?=$id_employee?>',this);return true}else{return false}">[ <?=$l_delete?> ]</span>
							                         <?php }else {}?>
												   </td>
											  </tr>
					                  	 <?php }?>
					              		 </table>
				             	  		<?php }?>
		                    		</div>
		                        </div>
		                        <div style="background:#f7f7f7; width:100%"> 
	                            <!--  <div style=" padding:10px; font-size:11px; color:#000; float:left; width:60%"><?php echo $fullnames."(".$time.")"?></div>-->
	                            <div style="float:right;" class="comment" >
	                           	<?php 
	                           	if($charge==1 && $_SESSION['poscoder']==1){?>
	                           			<a class="not_fix" onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ processUnChargeTestPro('<?=$id?>','<?=$idtestproject?>','<?=$id_employee?>','<?=$code?>',<?=$page?>,this);  return true;}else{return false;}"><img src="images/icon_not_fix.png" alt="" /><?php echo $l_uncharge;?></a> |
	                           			<?php }?>
								<?php if ($status==2){
										if ((($idemplTestpro==$id_employee) || ($_SESSION['posmanager']==1))){?>
									
										<input class="buttonProject hrestore" type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_reopen?>" 
												 onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ processReopenTestPro('<?=$id?>','<?=$idtestproject?>','<?=$id_employee?>',<?=$page?>,this);  return true;}else{return false;}"/> |
												 <input class="buttonProject hcomment" type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_comment?>" id="showcommand1" onclick="showthemcommand(this)"/>
										<input class="buttonProject hclose" type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_close?>" onclick="onclickError('<?=$id?>','<?=$id_employee?>','<?=$page?>')"/>
									<?php }
									}else if ($status==1){
										if((($idemplTestpro==$id_employee) || ($_SESSION['posmanager']==1)) && $prdelete==1){?>
										<input class="buttonProject hrestore" type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_reopen?>" 
												 onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ processReopenTestPro('<?=$id?>','<?=$idtestproject?>','<?=$id_employee?>',<?=$page?>,this);  return true;}else{return false;}"/> |
									<?php }else if (($_SESSION['postest']==1) || ($_SESSION['posmanager']==1)){?>
									
											<?php if ((($idemplTestpro==$id_employee)|| ($_SESSION['posmanager']==1) )&& ($prdelete==0)){?>
												<a class="conf" onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ processConfirmTestPro('<?=$id?>','<?=$idtestproject?>','<?=$id_employee?>',<?=$page?>,this);  return true;}else{return false;}"><img src="images/icon_confirm.png" alt="" /><?=$l_confirm_excel?></a>
												<a class="not_fix" onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ processNotFixTestPro('<?=$id?>','<?=$idtestproject?>','<?=$id_employee?>',<?=$page?>,this);  return true;}else{return false;}"><img src="images/icon_not_fix.png" alt="" /><?=$l_no_fix?></a> |
												
												<!--  <input class="buttonProject " type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_edit?>" 
		                                			onclick="edittile_testproject('<?=$idtestproject?>','<?=$id?>','<?=$id_employee?>','<?=$idprioty?>','<?=$page?>')" />-->
									
										<?php 	}?>
									<?php }
									}else if ($status==0){
										if((($idemplTestpro==$id_employee) || ($_SESSION['posmanager']==1)) && $prdelete==1){?>
										<input class="buttonProject hrestore" type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_reopen?>" 
												 onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ processReopenTestPro('<?=$id?>','<?=$idtestproject?>','<?=$id_employee?>',<?=$page?>,this);  return true;}else{return false;}"/> |
									<?php }else if (($_SESSION['postest']==1) || ($_SESSION['posmanager']==1)){
											$flag = 0;
											
											
											 if (($idemplTestpro==$id_employee)|| ($_SESSION['posmanager']==1)){
											$flag=1;
											if($_SESSION['posmanager']==1 && ($prdelete==0)){
											?>
												  <a class="conf" onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ processConfirmTestPro('<?=$id?>','<?=$idtestproject?>','<?=$id_employee?>',<?=$page?>,this);  return true;}else{return false;}"><img src="images/icon_confirm.png" alt="" /><?=$l_confirm_excel?></a> |
											<?php 
											}?>
										<?php }?>
									
										<?php if ((($_SESSION['poscoder']==1 && $charge==1)|| ($_SESSION['posmanager']==1)) && ($prdelete==0)){
												?>
												<a class="not_fix" onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ processFixedTestPro('<?=$id?>','<?=$idtestproject?>','<?=$id_employee?>',<?=$page?>,this);  return true;}else{return false;}"><img src="images/icon_fix.png" alt="" /><?=$l_fix_complete?></a> |
										<?php }
											}else{
												if($charge==1 || ($_SESSION['posmanager']==1)){
												?>
											
													<a class="not_fix" onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ processFixedTestPro('<?=$id?>','<?=$idtestproject?>','<?=$id_employee?>',<?=$page?>,this);  return true;}else{return false;}"><img src="images/icon_fix.png" alt="" /><?=$l_fix_complete?></a> |
									<?php 		} 
											}
									}else if ($status==-1){
										if( (($idemplTestpro==$id_employee) || ($_SESSION['posmanager']==1)) &&  $prdelete==1){?>
										<input class="buttonProject hrestore" type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_reopen?>" 
												 onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ processReopenTestPro('<?=$id?>','<?=$idtestproject?>','<?=$id_employee?>',<?=$page?>,this);  return true;}else{return false;}"/> |
									<?php }else if (($_SESSION['postest']==1) || ($_SESSION['posmanager']==1)){
											$flag = 0;
										
											 if ((($idemplTestpro==$id_employee)|| ($_SESSION['posmanager']==1) )&& ($prdelete==0)){
											 	
											$flag=1;
											if($correct==0){
											?>
												<a class="not_fix" onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ processCorrectTestPro1('<?=$id?>','<?=$idtestproject?>','<?=$id_employee?>',<?=$page?>,this);  return true;}else{return false;}"><img src="images/icon_fix.png" alt="" /><?php echo $l_correct;?></a> |
												<a class="conf" onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ processConfirmTestPro('<?=$id?>','<?=$idtestproject?>','<?=$id_employee?>',<?=$page?>,this);  return true;}else{return false;}"><img src="images/icon_confirm.png" alt="" /><?=$l_confirm_excel?></a> |
											<?php }
											?>
											
										<?php }?>
										<?php if ((($_SESSION['poscoder']==1 && $charge==1)|| ($_SESSION['posmanager']==1))&& ($prdelete==0) ){
												if($correct==1){
												?>
														<a class="not_fix" onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ processCorrectTestPro('<?=$id?>','<?=$idtestproject?>','<?=$id_employee?>',<?=$page?>,this);  return true;}else{return false;}"><img src="images/icon_fix.png" alt="" /><?php echo $l_correct;?></a> |
														<a class="not_fix" onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ processIncorrectTestPro('<?=$id?>','<?=$idtestproject?>','<?=$id_employee?>',<?=$page?>,this);  return true;}else{return false;}"><img src="images/icon_not_fix.png" alt="" /><?php echo $l_incorrect;?></a> |
												<?php }?>
										<?php }
											}else{
												if(($correct==1 && ($prdelete==0) && $charge==1)|| ($_SESSION['posmanager']==1)){
											?>
													<a class="not_fix" onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ processCorrectTestPro('<?=$id?>','<?=$idtestproject?>','<?=$id_employee?>',<?=$page?>,this);  return true;}else{return false;}"><img src="images/icon_fix.png" alt="" /><?php echo $l_correct;?></a> |
													<a class="not_fix" onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ processIncorrectTestPro('<?=$id?>','<?=$idtestproject?>','<?=$id_employee?>',<?=$page?>,this);  return true;}else{return false;}"><img src="images/icon_not_fix.png" alt="" /><?php echo $l_incorrect;?></a> |
											<?php }?>		
													
									<?php 	} 
									}
									
											if($charge==0 && $_SESSION['poscoder']==1){?>
												<a class="not_fix" onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ processChargeTestPro('<?=$id?>','<?=$idtestproject?>','<?=$id_employee?>','<?=$code?>',<?=$page?>,this);  return true;}else{return false;}"><img src="images/icon_fix.png" alt="" /><?php echo $l_charge;?></a> |
											<?php }?>
		                           					<input class="buttonProject hcomment" type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_comment?>" id="showcommand1" onclick="showthemcommand(this)"/>
													<input class="buttonProject hclose" type="button" style="margin: 5px 0;min-width: 70px" value="<?=$l_close?>" onclick="onclickError('<?=$id?>','<?=$id_employee?>','<?=$page?>')"/>		
	                             </div>
	                            <div class="clear"></div> 
	                        </div>
							</div>
						</td>
						<?php }
mysql_close($connection);
}
?>